using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
namespace CoOperativeManagementSystem
{
    public class dataBaseCtrl
    {
        
        string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=niravradb.mdb";
        public OleDbConnection database;
        public bool openConnection()
        {
            try
            {
                database = new OleDbConnection(connectionString);
                database.Open();
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
        }
        public int executeQuery(string queryString)
        {
            OleDbCommand SQLCommand = new OleDbCommand();
            SQLCommand.CommandText = queryString;
            SQLCommand.Connection = database;
            int response = -1;
            try
            {
                response = SQLCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return response;
        }
        

       
    }
}
